import React, { Component } from 'react';

class Demo extends Component{
  constructor(props){
    super(props);  
    console.log(props); //{msg:"牛"}
    console.log(this); //Demo实例
    console.log(this.props); //undefined => {"msg":牛}  super如果没有传入props则为undefined
  }
  render(){
    console.log(this); //Demo
    console.log(this.props); //{"msg":牛}
    return <h1>Demo组件 {this.props.msg}</h1>
  }
}

class App extends Component {
  constructor(props){
    super(props);
    // console.log(this.props)  //{} 空对象-没有值传入
    // console.log(props)       //{} 空对象-没有值传入
  }
  render() {
    return (
      <div>
        <Demo msg="牛"></Demo>
      </div>
    );
  }
}

export default App;
